package com.chensf.studydemo.guide.design

import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chensf.studydemo.R
import kotlinx.android.synthetic.main.activity_nestedscrollview_demo.*

class NestedScrollViewDemo : AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_nestedscrollview_demo)
        recyclerView.layoutManager = LinearLayoutManager(this)
        recyclerView.adapter = object : RecyclerView.Adapter<MyViewHolder>(){
            override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder =
                MyViewHolder(layoutInflater.inflate(R.layout.view_simple_list_item,parent,false))

            override fun getItemCount(): Int = 100

            override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
                (holder.itemView as TextView).text = "content $position"
                Log.d(NestedScrollViewDemo::class.java.simpleName, "onBindViewHolder: $position")
            }

        }
    }
}

class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){

}